
$(function () {
    $("#startTime").val(setDateTime(new Date(), 0) + " " + "00:00:00");
    $("#endTime").val(setDateTime(new Date(), 0) + " " + "23:59:59");
    $(".patient-content-switch > div").eq(0).click();
    getReturnList();
});

$(".patient-content-switch > div").click(function () {
    $(this).addClass('selection').siblings().removeClass('selection')
});

function getReturnList() {  ////点击返回跳转页面 - 首页
    var startTime =  $("#startTime").val();
    var endTime =  $("#endTime").val();
    var area =  $("#area").val();
    var outpatientName =  $("#outpatientName").val();
    var department =  $("#department").val();
    var accessDisease =  $("#accessDisease").val();
    var appointmentPayService =  $("#appointmentPayService").val();
    var statuss =  $("#statuss").val();
    var status =  $("#status").val();
    var oneChannel =  $("#oneChannel").val();
    var twoChannel =  $("#twoChannel").val();
    var thrChannel =  $("#thrChannel").val();
    var archiving =  $("#archiving").val();
    var follower =  $("#follower").val();
    $.ajax({
        url: Feng.ctxPath + "/marketPatientsCentral/market_returnVisit_list",
        type: "post",
        data: {
            "startTime": startTime,
            "endTime": endTime,
            "area": area,
            "outpatientName": outpatientName,
            "department": department,
            "accessDisease": accessDisease,
            "appointmentPayService": appointmentPayService,
            "statuss": statuss,
            "status": status,
            "oneChannel": oneChannel,
            "twoChannel": twoChannel,
            "thrChannel": thrChannel,
            "archiving": archiving,
            "follower": follower
        },
        success: function (data) {
            var text = '';
            for (var i = 0; i < data.length; i++) {
                text += ' <div class="patient-box-item" onclick="market_patient_returnVisit('+"'"+ data[i].id +"'"+')" > ' +
                    '    <div class="patient-box-item-top"> ' +
                    '        <div class="patient-item-portrait"> ' ;
                if(data[i].customerSex==1){
                    text+= '<img src="https://pynnn.oss-cn-hangzhou.aliyuncs.com/weixin-img/app/portrait01.png" alt="加载中...">\n' ;
                }else if(data[i].customerSex==2){
                    text+= '<img src="https://pynnn.oss-cn-hangzhou.aliyuncs.com/weixin-img/app/portrait02.png" alt="加载中...">\n' ;
                }else {
                    text+= '<img src="https://pynnn.oss-cn-hangzhou.aliyuncs.com/weixin-img/app/portrait03.png" alt="加载中...">\n' ;
                }
                text+= '</div> ' +
                    '  <div class="patient-item-information"> ' +
                    '   <div class="patient-item-information-show"> ' +
                    '     <div><span>' + data[i].customerName + '</span><span>' + data[i].customerAge + '岁 </span></div> ' +
                    '     <div>' + data[i].customerPhone + '</div> ' +
                    '   </div> ' +
                    '   <div class="patient-item-information-operation"> ' +
                    '      <i class="layui-icon layui-icon-rate-solid"></i> ' +
                    '   </div> ' +
                    '  </div> ' +
                    ' </div> ' +
                    '</div>';
            }
            $("#marketReturnVisitList").html(text);
        },
        error: function (data) {

        }
    });
}

function patient_backHome() {  ////点击返回跳转页面 - 首页
    window.location.href = Feng.ctxPath + "/weixin/index";
}

function market_patient_returnVisit(id) {
    window.location.href = Feng.ctxPath + "/marketPatientsCentral/marketPatient_returnVisit/" + id ;
}

function deployment_conditions(obj) {
    $(obj).hide().siblings().show();
    $(".patient-box-election").show().siblings().hide();
}

function marketDeployment_complete(obj) {
    getReturnList();
    $(obj).hide().siblings().show();
    $(".patient-box-content").show().siblings().hide();
}

